import { ElMessageBox } from 'element-plus'

export const resAlert = async (title: string, response: ErrorProp) => {
  return await ElMessageBox.alert(`【${response?.code}】${response.msg}`, {
    title: title
  })
}

/**
 * 获取当前设备滚轮受支持的事件名
 * @returns 当前设备支持的方式
 */
export const getWheelSupportType = () => {
  const support =
  'onwheel' in document.createElement('div')
    ? 'wheel'
    // eslint-disable-next-line
    : (document as any).onmousewheel !== undefined
      ? 'mousewheel'
      : 'DOMMouseScroll'
  return support
}

export default {
  getWheelSupportType,
  resAlert
}
